-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Support Go 1.26 and later with Swiss maps always enabled #19088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In Go 1.26 and later Swiss maps are enabled by default and there is no more GOEXPERIMENT=noswissmap nor GOEXPERIMENT=swissmap flag either. See: * golang/go@2ae059c * golang/go#54766 Signed-off-by: Štefan Baebler <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
| @@ -1,4 +1,4 @@ | |||
| //go:build !goexperiment.swissmap | |||
| //go:build !goexperiment.swissmap && !go1.26 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should flip this flag to goexperiment.swissmap .noswissmap instead of !goexperiment.swissmap which would work also still for 1.26 if the flag is entirely gone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be much cleaner, if goexperiment.noswissmap build constraint existed.
GOEXPERIMENT=noswissmap environment setting existed in Go 1.24 and 1.25 to disable swiss maps and was negated mapped to goexperiment.swissmap build constraint. Hence the confusion.
In go 1.26 GOEXPERIMENT=noswissmap is not supported anymore and there is no way to set goexperiment.swissmap build constraint either, so the only option is to check for go1.26 build constraint.
PR ref: * Upstream vitessio/vitess#19088 * #258912
mattlord
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @stefanb !
Description
Adjusts Go build flags for ensuring Swiss maps are available to not trigger false positive compile-time errors with Go 1.26 and later.
In Go 1.26 and later Swiss maps are always enabled and cannot be disabled anymore (as was the case in Go 1.24-1.25) and there is no more
GOEXPERIMENT=noswissmapflag. See:Related Issue(s)
Fixes #19087
Checklist
Deployment Notes
N/A
AI Disclosure
No AI was used for preparing this patch.